<div class="page-content" >
	<div class="panel panel-default">
		<div class="panel-heading"> <a href="<{:addons_url('index')}>">素材管理</a>> 添加/编辑素材</div>
		<div class="panel-body">
			<form id="myform" method="post"  class="form-horizontal" action="<{:addons_url('insertType')}>">
				<input type="hidden" name="id" value="<{$data.id}>">
				<div class="form-group">
					<label for="input-title" class="col-sm-2 control-label">素材名称</label>
					<div class="col-sm-7">
						<input  type="text" class="form-control" id="name" name="name" value="<{$data.name}>">
					</div>
				</div>
				<div class="form-group">
					<label for="input-title" class="col-sm-2 control-label">素材ID</label>
					<div class="col-sm-7"> <input type="text" class="form-control" 
						<if condition="$data['keyName'] eq 'firstConcern'">readonly="true"</if>
						id="keyName" name="keyName" value="<{$data.keyName}>"> </div>
				</div>
				<div class="form-group">
					<label for="input-title" class="col-sm-2 control-label">默认文字消息</label>
					<div class="col-sm-7">
						<textarea id="text"  class="form-control" placeholder="(当没有设置图文消息时，回复本文字消息)" name="text" style="height:80px" ><{$data.text}></textarea>
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-7">
						<button type="submit" class="btn btn-primary">保存</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>

<script>
 
$(function(){
    $(".form-horizontal").bootstrapValidator({
        message: '您填入的值不合法',
        fields:{
            name: {
                message: '素材名称',
                validators: {
                    notEmpty: {
                        message: '素材名称不能为空'
                    },
                }
            },
			keyName: {
                message: '素材ID',
                validators: {
                    notEmpty: {
                        message: '素材ID不能为空'
                    },
                }
            },
			  

        }
    });
	
 
});
 </script>
